package com.bawei.mall.search.controller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.search.domain.HotWord;
import com.bawei.mall.search.service.KeyWordSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：sxq
 * @Package：com.bawei.mall.search.controller
 * @Project：mall_cloud
 * @name：KeyWordSearchControiller
 * @Date：2024/6/25 20:23
 */
@RestController
@RequestMapping("searchKey")
public class KeyWordSearchController {

    @Autowired
    private KeyWordSearchService keyWordSearchService;

    /**
     * 查询猜你喜欢关键词
     * @return
     */
    @GetMapping("/hotWord")
    public R<List<String>> byKeyName(){
      return  R.ok(keyWordSearchService.byKeyWords());
    }


    /**
     * 添加猜你喜欢关键词
     * @return
     */
    @PostMapping("/addHotWord")
    public R addHotWord(@RequestBody HotWord keyWords){
        keyWordSearchService.addKeyWords(keyWords);
        return  R.ok();
    }
}
